home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / SourceCode / MiniExamples / Rotato / TestView.m < prev    next >
Encoding:
Text File  |  1992-12-13  |  1.2 KB  |  71 lines

  1. /*  
  2.  * 
  3.  * TestView.m    -- How to rotate an NXImage
  4.  * 
  5.  * This View is the view that displays the NXImage.  The actual rotation
  6.  * is done in MyImage
  7.  *
  8.  * You may freely copy, distribute, and reuse the code in this example.
  9.  * NeXT disclaims any warranty of any kind, expressed or  implied, as to its
  10.  * fitness for any particular use.
  11.  *
  12.  * Written by Henry Krempel -- NeXT Developer Support
  13.  *
  14.  * Wed Apr 10 17:39:50 1991
  15.  */
  16. #import "TestView.h"
  17. #import "MyImage.h"
  18. #import <defaults/defaults.h>
  19. #import <appkit/Control.h>
  20. #import <dpsclient/wraps.h>
  21. #import <strings.h>
  22.  
  23. @implementation TestView
  24.  
  25. - initFrame:(NXRect *)r
  26. {
  27.     [super initFrame:r];
  28.     image1 = [[MyImage alloc] initFromSection:"one"];
  29.  
  30.     return self;
  31. }
  32.  
  33. /*
  34.  * Set the rotation from the value of the sender (could be a slider)
  35.  *
  36.  */
  37.  
  38. - setR1:sender
  39. {
  40.     [image1 setRotation:[sender intValue]];
  41.     [self display];
  42.     return self;
  43. }
  44.  
  45.  
  46. - flipImage:sender
  47. {
  48.     [image1 flip:sender];
  49.     [self display];
  50.     return self;
  51. }
  52.  
  53. /*
  54.  * the drawing routine:  fill with grey,  and then composite the image
  55.  *
  56.  */
  57.  
  58. - drawSelf:(NXRect *)r :(int)rectCount
  59. {
  60.     NXPoint p1 = {0.0, 0.0};
  61.  
  62.     PSsetgray (NX_LTGRAY);
  63.     NXRectFill (&bounds);
  64.  
  65.     [image1 composite:NX_SOVER toPoint:&p1];
  66.  
  67.     return self;
  68. }
  69.  
  70. @end
  71.